#include <iostream>
class Singleton{
	private:
		static Singleton *_instance;		
	protected:
		Singleton(){}
	public:
		static Singleton *instance();
		int getx(){
			return 3;
		}
};

Singleton* Singleton::_instance = 0;

Singleton* Singleton::instance(){
	if(_instance == 0){
		return new Singleton;
	}
	return _instance;
}

int main(){
	std::cout << Singleton::instance()->getx() << std::endl;
	return 0;
}
